{% extends '../../../layout/admin-base.html' %}
<script src="{{ assets_path("js/base.js")}}"></script>
{% block page %}
<h3 class="page-title">
    学生信息 <small>列表</small>
</h3>
<ul class="breadcrumb">
    <li>
        <i class="icon-home"></i>
        <a href="index.html">基本信息管理</a> 
        <i class="icon-angle-right"></i>
    </li>
    <li>
        <a href="{{url('admin/user/student')}}">学生信息管理</a>
        <i class="icon-angle-right"></i>
    </li>
    <li><span>列表</span></li>
</ul>
{% end%}
{% block content %}

<div class="row-fluid">
    <div class="span12">
        <div class="portlet box red">
            <div class="portlet-title">
                <div class="caption"><i class="icon-search"></i>搜索条件</div>
                <div class="tools">
                    <a href="javascript:;" class="collapse"></a>
                </div>
            </div>
            <div class="portlet-body form">
                <!-- BEGIN FORM-->
                <form action="" class="horizontal-form" method="post" >
                    <div class="row-fluid">
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label" for="studentName">学生姓名</label>
                                <div class="controls">
                                    <input type="text" id="studentName" name="sname" value="{{ where.get('Fname', '') }}" class="m-wrap span12" placeholder="">
                                </div>
                            </div>
                        </div>
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label" for="no">学号</label>
                                <div class="controls">
                                    <input type="text" id="no" name="sno" value="{{ where.get('Fno', '') }}" class="m-wrap span12" placeholder="">
                                </div>
                            </div>
                        </div>
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label" for="dormNo">宿舍楼号</label>
                                <div class="controls">
                                    <select class="span12 m-wrap"  id="dormNo" name="sdorm">
                                        <option value="-1"></option>
                                        {% for i in drom %}
                                            <option value="{{ i['Fid'] }}" {% if i["Fid"]==where.get("Fdorm_id", '') %}selected='selected'{% end %}>{{ i['Fdorm_name'] }}</option>
                                        {% end %}
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label">是否认证通过</label>
                                <div class="controls">
                                    <select class="m-wrap span12" name="sstatus">
                                        <option value="-1"></option>
                                        <option value="1" {% if '1'==where.get("Fstatus", '') %}selected='selected'{% end %}>认证通过</option>
                                        <option value="0" {% if '0'==where.get("Fstatus", '') %}selected='selected'{% end %}>认证失败</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--/row-->
                    <div class="form-actions">
                        <button type="submit" class="btn blue"><i class="icon-search"></i>搜索</button>
                        <button type="button" class="btn">清空</button>
                    </div>
                </form>
                <!-- END FORM--> 
            </div>
        </div>
        <!-- BEGIN EXAMPLE TABLE PORTLET-->
        <div class="portlet box light-grey">
            <div class="portlet-title">
                <div class="caption"><i class="icon-list"></i>学生列表</div>
                <div class="tools">
                    <a href="javascript:;" class="collapse"></a>
                    <a href="#portlet-config" data-toggle="modal" class="config"></a>
                    <a href="javascript:;" class="reload"></a>
                    <!-- <a href="javascript:;" class="remove"></a> -->
                </div>
            </div>
            <div class="portlet-body">
                <div class="clearfix">
                    <div class="btn-group">
                        <a id="sample_editable_1_new" class="btn green" href="{{url('admin/user/student/new')}}">
                        增加<i class="icon-plus"></i>
                        </a>
                        <a id="status_ture" class="btn blue">
                        批量通过<i class="icon-ok"></i>
                        </a>
                        <a id="status_false" class="btn yellow">
                        批量不通过<i class="icon-ban-circle"></i>
                        </a>
                    </div>
                    <div class="btn-group pull-right">
                        <button class="btn dropdown-toggle" data-toggle="dropdown">工具<i class="icon-angle-down"></i>
                        </button>
                        <ul class="dropdown-menu pull-right">
                            <li><a href="#">打印</a></li>
                            <li><a href="#">另存为PDF</a></li>
                            <li><a href="#">另存为Excel</a></li>
                        </ul>
                    </div>
                </div>
                <table class="table table-striped table-bordered table-hover" id="sample_1">
                    <thead>
                        <tr>
                            <th style="width:8px;"><input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes" /></th>
                            <th>学生姓名</th>
                            <th class="hidden-300">学号</th>
                            <th class="hidden-240">宿舍楼号</th>
                            <th class="hidden-300">寝室号</th>
                            <th class="hidden-300">手机号</th>
                            <!-- <th class="hidden-480">备注</th> -->
                            <th class="hidden-200">注册时间</th>
                            <th class="hidden-200">是否认证</th>
                            <th ></th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for i in data %}
                        <tr class="odd gradeX">
                            <td><input type="checkbox" class="checkboxes" value="{{ i['Fid'] }}" name="select" /></td>
                            <td>{{ i["Fname"] }}</td>
                            <td>{{ i["Fno"] }}</td>
                            <td>{{ i["Fdorm_name"] }}</td>
                            <td>{{ i["Froom"] }}</td>
                            <td>{{ i["Ftel"] }}</td>
                            <!-- <td class="hidden-100"></td> -->
                            <td class="hidden-100">{{ stamp_2_time(i["Fcreate_time"]) }}</td>
                            <td class="center hidden-100">
                                {% if i["Fstatus"] == '1' %}
                                    <span class="label label-success">已验证</span>
                                {% else %}
                                    <span class="label label-error">未验证</span>
                                {% end %}
                            </td>
                            <td><a class="btn mini purple" href="{{ reverse_url('student.edit', i['Fid']) }}">
                                    <i class="icon-edit"></i>编辑
                                </a>
                                <a class="btn mini black" href="{{ reverse_url('student.del_student', i['Fid'], page_info['page']) }}">
                                    <i class="icon-trash"></i>删除
                                </a>
                                <a class="btn mini blue" href="{{ reverse_url('student.set_status', i['Fid'], '1', page_info['page']) }}">
                                    <i class="icon-ok"></i>通过
                                </a>
                                <a class="btn mini yellow" href="{{ reverse_url('student.set_status', i['Fid'], '0', page_info['page']) }}">
                                    <i class="icon-ban-circle"></i>不通过
                                </a>
                            </td>
                        </tr>
                        {% end %}
                       <!--  <tr class="odd gradeX">
                            <td><input type="checkbox" class="checkboxes" value="1" /></td>
                            <td>looper</td>
                            <td class="hidden-480"><a href="mailto:looper90@gmail.com">looper90@gmail.com</a></td>
                            <td class="hidden-480">120</td>
                            <td class="center hidden-480">12.12.2011</td>
                            <td ><span class="label label-warning">Suspended</span></td>
                        </tr>
                        <tr class="odd gradeX">
                            <td><input type="checkbox" class="checkboxes" value="1" /></td>
                            <td>userwow</td>
                            <td class="hidden-480"><a href="mailto:userwow@yahoo.com">userwow@yahoo.com</a></td>
                            <td class="hidden-480">20</td>
                            <td class="center hidden-480">12.12.2012</td>
                            <td ><span class="label label-success">Approved</span></td>
                        </tr>
                        <tr class="odd gradeX">
                            <td><input type="checkbox" class="checkboxes" value="1" /></td>
                            <td>user1wow</td>
                            <td class="hidden-480"><a href="mailto:userwow@gmail.com">userwow@gmail.com</a></td>
                            <td class="hidden-480">20</td>
                            <td class="center hidden-480">12.12.2012</td>
                            <td ><span class="label label-inverse">Blocked</span></td>
                        </tr> -->

                    </tbody>
                </table>
                {% module Paginate(page_info['total'], page_info['page']) %}
            </div>
        </div>
        <!-- END EXAMPLE TABLE PORTLET-->
    </div>
</div>
<script type="text/javascript">
window.onload = function(){

    function set_status(t){
        data = ''
        for(var i = 0;i < $("input[name='select']").length;i++){
            if($("input[name='select']")[i].checked){
                data += $("input[name='select']")[i].value + ','
            }
        }
        if(data != ''){
            $.post("{{ reverse_url('student.set_istatus', page_info['page'], '') }}" + t,{data:data},function(result){
                window.location.href = '{{ reverse_url("student.index") }}page={{ page_info["page"] }}'
            });
        }
    }

    $('#status_ture').click(function(){
        set_status('1')
        
    })
    $('#status_false').click(function(){
        set_status('0')
    })
}
</script>
{% end%}